<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>表格与列表标签示例</title>
<style>
table { 
  margin-left: auto; 
  margin-right: auto;
  border: 1px solid black; 
  line-height: 1.25;
  width: 100%;
  text-align: center; 
  border-spacing: 0px 1px; 
  border-collapse: collapse;
  table-layout:fixed;
}

/* table th { 
  border: 1px solid black;
  line-height: 1;
  padding: 7px;
  background-color: #dddddd;
  text-align:center;
}
*/
table td { 
  border: 1px solid black; 
  padding: 5px;
  text-align:left;
} 
</style>
</head>
<body>
<!-- 示例1.常规表格示例 -->
<table border="1">
  <caption style="font-weight: bolder;">常规表格示例</caption>
  <tr>
    <th>班级</th>
    <th>人数</th>
    <th>优生率</th>
  </tr>
  <tr>
    <td>一班</td>
    <td>30</td>
    <td>90%</td>
  </tr>
  <tr>
    <td>二班</td>
    <td>50</td>
    <td>80%</td>
  </tr>
</table>
<p>每个表格由 table 标签开始。</p>
<p>每个表格行由 tr 标签开始。</p>
<p>每个表格头由 th 标签指定。</p>
<p>每个表格数据由 td 标签开始。</p>
<table>
  <caption>Color names and values</caption>
  <tbody>
    <tr>
      <th scope="col">Name</th>
      <th scope="col">HEX</th>
      <th scope="col">HSLa</th>
      <th scope="col">RGBa</th>
    </tr>
    <tr>
      <th scope="row">Teal</th>
      <td><code>#51F6F6</code></td>
      <td><code>hsla(180, 90%, 64%, 1)</code></td>
      <td><code>rgba(81, 246, 246, 1)</code></td>
    </tr>
    <tr>
      <th scope="row">Goldenrod</th>
      <td><code>#F6BC57</code></td>
      <td><code>hsla(38, 90%, 65%, 1)</code></td>
      <td><code>rgba(246, 188, 87, 1)</code></td>
    </tr>
  </tbody>
</table>

<hr>
<p> tr / td / th 标签细讲</p>
<h4>一列：</h4>
<table border="1">
<tr><td>100</td></tr>
</table>

<h4>一行三列：</h4>
<table border="1">
<tr>
  <td>100</td>
  <td>200</td>
  <td>300</td>
</tr>
</table>

<h4>普通表头：</h4>
<table border="1">
<tr>
  <th>姓名</th>
  <th>电话</th>
  <th>电话</th>
</tr>
<tr>
  <td>Bill Gates</td>
  <td>555 77 854</td>
  <td>555 77 855</td>
</tr>
</table>

<h4>垂直的表头：</h4>
<table border="1">
<tr>
  <th>姓名</th><td>Bill Gates</td>
</tr>
<tr>
  <th>电话</th><td>555 77 854</td>
</tr>
<tr>
  <th>电话</th><td>555 77 855</td>
</tr>
</table>

<h4>本例演示一个带标题 (caption) 的表格</h4>

<table border="1">
  <caption>表格标题</caption>
  <tr>
    <th>这是表头</th>
  </tr>
  <tr>
    <td>数据单元</td>
  </tr>
  <tr>
     <td>数据单元</td>
  </tr>
  <tr>
     <td>数据单元</td>
  </tr>
</table>



<h4>没有 cellpadding：</h4>
<table border="1">
<tr>
  <td>First</td>
  <td>Row</td>
</tr>
<tr>
  <td>Second</td>
  <td>Row</td>
</tr>
</table>

<h4>带有 cellpadding：</h4>
<table border="1" cellpadding="11">
<tr>
  <td>First</td>
  <td>Row</td>
</tr>
<tr>
  <td>Second</td>
  <td>Row</td>
</tr>
</table>

<h4>单元背景：</h4>
<table border="1">
<tr>
  <td bgcolor="red">First</td>
  <td>Row</td>
</tr>
<tr>
  <td
  background="/i/eg_bg_07.gif">
  Second</td>
  <td>Row</td>
</tr>
</table>

<table border="1">

<tr>
  <td>
   <p>这是一个段落。</p>
   <p>这是另一个段落。</p>
  </td>
  <td>这个单元包含一个表格：

      <table border="1">
        <tr>
            <td>A</td>
            <td>B</td>
        </tr>
        <tr>
            <td>C</td>
            <td>D</td>
       </tr>
      </table>

  </td>
</tr>

<tr>
  <td>这个单元包含一个列表：
   <ul>
    <li>苹果</li>
    <li>香蕉</li>
    <li>菠萝</li>
   </ul>
  </td>
  <td>HELLO</td>
</tr>
</table>


<p><b>注释：</b>frame 属性无法在 Internet Explorer 中正确地显示。</p>

<p>Table with frame="box":</p>
<table frame="box">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

<p>Table with frame="above":</p>
<table frame="above">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

<p>Table with frame="below":</p>
<table frame="below">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

<p>Table with frame="hsides":</p>
<table frame="hsides">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

<p>Table with frame="vsides":</p>
<table frame="vsides">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>

<hr />
<table width="100%" border="1">

  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
  <tr>
    <td>2489604</td>
    <td>My first CSS</td>
    <td>$47</td>
  </tr>
</table>

<br>
<p>colgroup 与 col 示例</p>
<style>
.build {
  background-color: #d7d9f2;
}

.explain {
  background-color: #ffe8d4;
}
td {
  text-align: center;
}
</style>
<table>
  <caption>编程开发语言</caption>
  <colgroup>
      <col>
      <col span="2" class="build">
      <col span="2" class="explain">
  </colgroup>
  <tr>
      <td> </td>
      <th scope="col">C</th>
      <th scope="col">C++</th>
      <th scope="col">Python</th>
      <th scope="col">JavaScript</th>
  </tr>
  <tr>
      <th scope="row">Skill</th>
      <td>Smarts</td>
      <td>Dex, acrobat</td>
      <td>Super speed</td>
      <td>Super speed</td>
  </tr>
</table>
<br/>
<table>
  <caption>表格标题</caption>
  <!-- 头 -->
  <thead>
    <tr>
      <th scope="col">Items</th>
      <th scope="col">Expenditure</th>
    </tr>
  </thead>
  <!-- 尾部 -->
  <tfoot>
    <tr>
      <td scope="row">文具；信纸；信笺</td>
      <td>支出；开支；</td>
    </tr>
    <tr>
      <td scope="row">文具；信纸；信笺</td>
      <td>支出；开支；</td>
    </tr>
  </tfoot>
  <!-- 主体 -->
  <tbody>
      <tr>
        <th scope="row">Donuts</th>
        <td>3,000</td>
      </tr>
      <tr>
        <th scope="row">Stationery</th>
        <td>18,000</td>
      </tr>
  </tbody>
</table>


</body>
<html>
